using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


namespace SIS.BLL {

/// <summary>
/// The TeacherAddressTableManager class is responsible for managing BO.TeacherAddressTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class TeacherAddressTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all TeacherAddressTable objects in the database.
/// </summary>
/// <returns>A list with all TeacherAddressTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static TeacherAddressTableList GetList(){
return TeacherAddressTableDB.GetList();
}

/// <summary>
/// Gets a single TeacherAddressTable from the database without its data.
/// </summary>
/// <param name="teacherAddressKey">The TeacherAddressKey of the TeacherAddressTable in the database.</param>
/// <returns>A TeacherAddressTable object when the TeacherAddressKey exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static TeacherAddressTable GetItem(int teacherAddressKey){
return GetItem(teacherAddressKey, false);
}

[DataObjectMethod(DataObjectMethodType.Select, false)]
public static TeacherAddressTable GetItemByUserAccountKey(int UserAccountKey, Int16 AddressTypeCode)
{
    TeacherAddressTable myTeacherAddressTable = TeacherAddressTableDB.GetItemByUserAccountKey(UserAccountKey, AddressTypeCode);
    return myTeacherAddressTable;
}

/// <summary>
/// Gets a single TeacherAddressTable from the database.
/// </summary>
/// <param name="teacherAddressKey">The TeacherAddressKey of the TeacherAddressTable in the database.</param>
/// <param name="getTeacherAddressTableRecords">Determines whether to load all associated TeacherAddressTable records as well.</param>
/// <returns>
/// A TeacherAddressTable object when the TeacherAddressKey exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static TeacherAddressTable GetItem(int teacherAddressKey, bool getTeacherAddressTableRecords){
TeacherAddressTable myTeacherAddressTable = TeacherAddressTableDB.GetItem(teacherAddressKey);
return myTeacherAddressTable;
}

/// <summary>
/// Saves a TeacherAddressTable in the database.
/// </summary>
/// <param name="myTeacherAddressTable">The TeacherAddressTable instance to save.</param>
/// <returns>The new TeacherAddressKey if the TeacherAddressTable is new in the database or the existing TeacherAddressKey when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static int Save(TeacherAddressTable myTeacherAddressTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
int teacherAddressTableTeacherAddressKey = TeacherAddressTableDB.Save(myTeacherAddressTable);

//  Assign the TeacherAddressTable its new (or existing TeacherAddressKey).
myTeacherAddressTable.TeacherAddressKey = teacherAddressTableTeacherAddressKey;

myTransactionScope.Complete();

return teacherAddressTableTeacherAddressKey;
}
}

/// <summary>
/// Deletes a TeacherAddressTable from the database.
/// </summary>
/// <param name="myTeacherAddressTable">The TeacherAddressTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(TeacherAddressTable myTeacherAddressTable){
return TeacherAddressTableDB.Delete(myTeacherAddressTable.TeacherAddressKey);
}

#endregion

}

}
